package com.chpn.config;

import com.chpn.bean.Student;
import com.chpn.controller.StudentController;
import com.chpn.service.StudentService;
import org.springframework.context.annotation.*;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;

@Configuration  //指定是一个配置类
@ComponentScan(
        value = {"com.chpn"},
        excludeFilters = {
                @ComponentScan.Filter(type = FilterType.ANNOTATION,classes = {Controller.class, Service.class})//注解排除--排除@Controller、@Service注解的类
        }

)
public class MainConfig {

    @Bean(value = "student01")
    public Student student01(){
        return new Student().setStudentId(1).setClassNo("101").setName("Jim");
    }

    @Scope("prototype")
    @Bean(value = "student02")
    public Student student02(){
        return new Student().setStudentId(2).setClassNo("101").setName("tom");
    }
}
